<template>
  <uni-nav-bar title="发票详情" left-icon="left" @clickLeft="navBack" :fixed="true" statusBar></uni-nav-bar>
  <view class="package" style="padding:0px 30rpx;">
    <view class="space-between lis">
      <view style="font-size: 36rpx;">发票明细</view>
      <view style="color:#1D8DFF" @click="redirectTo('fleet/money/invoice?id='+orderID+'&type=1')"
        v-if="userInfo.invoiceAll.status==0">修改发票信息 ></view>
    </view>
    <view class="space-between lis">
      <view>发票类型</view>
      <view>电子发票</view>
    </view>
    <view class="space-between lis">
      <view>抬头类型</view>
      <view style="width:70%;text-align: right;">{{userInfo.invoiceAll.type==='company'?'企业':'个人'}}</view>
    </view>
    <view class="space-between lis" v-if="userInfo.invoiceAll.title">
      <view>抬头名称</view>
      <view style="width:70%;text-align: right;">{{userInfo.invoiceAll.title}}</view>
    </view>
    <view class="space-between lis" v-if="userInfo.invoiceAll.code">
      <view>税号</view>
      <view>{{userInfo.invoiceAll.code}}</view>
    </view>
    <view class="space-between lis" v-if="userInfo.invoiceAll.name">
      <view>户名</view>
      <view>{{userInfo.invoiceAll.name}}</view>
    </view>
    <view class="space-between lis" v-if="userInfo.invoiceAll.bank">
      <view>开户银行</view>
      <view>{{userInfo.invoiceAll.bank}}</view>
    </view>
    <view class="space-between lis" v-if="userInfo.invoiceAll.bank_code">
      <view>银行账号</view>
      <view>{{userInfo.invoiceAll.bank_code}}</view>
    </view>
    <view class="space-between lis" v-if="userInfo.invoiceAll.address">
      <view>企业地址</view>
      <view>{{userInfo.invoiceAll.address}}</view>
    </view>
    <view class="space-between lis" v-if="userInfo.invoiceAll.mobile">
      <view>电话</view>
      <view>{{userInfo.invoiceAll.mobile}}</view>
    </view>
    <view class="space-between lis" v-if="userInfo.invoiceAll.email">
      <view>邮箱</view>
      <view>{{userInfo.invoiceAll.email}}</view>
    </view>
    <view class="space-between lis">
      <view>申请时间</view>
      <view>{{userInfo.invoiceAll.createtime}}</view>
    </view>
    <view class="space-between lis" v-if="userInfo.invoiceAll.updatetime">
      <view>开票时间</view>
      <view>{{userInfo.invoiceAll.updatetime}}</view>
    </view>
  </view>
</template>

<script setup lang="ts">
  import { navBack, redirectTo } from '@/utils/navigator';
  import { ref } from 'vue';
  import { onLoad, onUnload } from '@dcloudio/uni-app';
  import { useUserStore } from '@/stores/user';
  const userInfo = useUserStore();
  const orderID = ref('')
  onLoad((pearm) => {
    orderID.value = pearm.id
    userInfo.invoice(pearm.id)
  })
  onUnload(() => {
    uni.removeStorageSync('invoiceAll');
  })
</script>

<style scoped lang="less">
  .lis:nth-last-of-type(1) {
    border-bottom: 0px;
  }

  .lis {
    padding: 35rpx 0px;
    box-sizing: border-box;
    border-bottom: 1px solid #eee;
  }
</style>